package com.anlu.base.function.mode;

import com.alibaba.fastjson2.JSON;
import com.alibaba.fastjson2.annotation.JSONType;
import com.anlu.base.function.enums.FunEnum;
import com.anlu.base.function.mode.type.FormComponentDataBooleanBO;
import com.anlu.base.function.mode.type.FormComponentDataListStringBO;
import com.anlu.base.function.mode.type.FormComponentDataStringBO;
import com.fasterxml.jackson.annotation.JsonSubTypes;
import com.fasterxml.jackson.annotation.JsonTypeInfo;
import lombok.Data;
import lombok.Getter;
import lombok.Setter;
import lombok.ToString;

@Getter
@Setter
@ToString
@JsonTypeInfo(
        use = JsonTypeInfo.Id.NAME,
        include = JsonTypeInfo.As.EXISTING_PROPERTY,//作为json的一个字段
        property = "type",//Json中的字段
        visible = true
)

@JsonSubTypes(
        {
                @JsonSubTypes.Type(value = FormComponentDataBooleanBO.class,name = FunEnum.X.BOOLEAN ),
                @JsonSubTypes.Type(value = FormComponentDataStringBO.class,name = FunEnum.X.TEXT),
                @JsonSubTypes.Type(value = FormComponentDataListStringBO.class,name = FunEnum.X.SELECT)
        }
)
@Data
public class FormComponentBaseBO <VALUE>{

    private String key;

    private FunEnum type;

    private String title;

    private FormComponentValueBaseBO<VALUE> value;

    public String getKey() {
        return key;
    }

    public void setKey(String key) {
        this.key = key;
    }

    public FunEnum getType() {
        return type;
    }

    public void setType(FunEnum type) {
        this.type = type;
    }

    public String getTitle() {
        return title;
    }

    public void setTitle(String title) {
        this.title = title;
    }

    public FormComponentValueBaseBO<VALUE> getValue() {
        return value;
    }

    public void setValue(FormComponentValueBaseBO<VALUE> value) {
        this.value = value;
    }
}
